﻿using Nethereum.Hex.HexConvertors.Extensions;
using Nethereum.Model;
using Xunit;

namespace Nethereum.Accounts.IntegrationTests
{
    public class BloomFilterTest
    {
        [Fact]
        public void ShouldMatchBloomFilter()
        {
            var address = "0x095e7baea6a6c7c4c2dfeb977efac326af552d87";
            var topic = "0000000000000000000000000000000000000000000000000000000000000000".HexToByteArray();
            var bloom = new LogBloomFilter();
            var log = Log.Create(address, topic);
            bloom.AddLog(log);
                
            var expected =
                "00000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000040000000000000000000000000000000000000000000000000000000";
            var hexBloom = bloom.Data.ToHex();
            Assert.Equal(expected, hexBloom);
        }
    }
}